﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Entities;
using Utility;
using BUS;

public partial class Administrator_nhanvien_sua : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            load_data();
        }
    }
    private void load_data()
    {
        int id = int.Parse(Request.QueryString["id"].ToString());
        Tbl_NhanVien_Entities nv = Tbl_NhanVien_BUS.GetByID(id);
        Literal1.Text = id.ToString();
        txt_tk.Text = nv.TaiKhoan;
        txt_mk.Text = nv.MatKhau;

    }

    protected void bt_sua_Click(object sender, EventArgs e)
    {
        Tbl_NhanVien_Entities nv = Tbl_NhanVien_BUS.GetByID(int.Parse(Literal1.Text));
        nv.TaiKhoan = txt_tk.Text;
        nv.MatKhau = txt_mk.Text;

        Tbl_NhanVien_BUS.Update(nv);
        Literal1.Text = "Cập nhật thành công";
        HyperLink1.Visible = true;
        HyperLink1.Text = "Về trang danh sách nhân viên";
        HyperLink1.NavigateUrl = "~/Administrator/nhanvien_ds.aspx";


    }
}
